EMT Practice Test

1. Question Content...


Question List

Question1: A Lightning component has a wired property, searchResults, that stores a list of Opportunities. Which definition of the Apex method, to which the searchResults property is wired, should be used?

Question2: A developer is creating a page that allows users to create multiple Opportunities. The developer is asked to verify the current user's default } | Opportunity record type, and set certain default values based on the record type before inserting the record. i, J Calculator How can the developer find the current user's default record type? ns

Question3: A developer must modify the following code snippet to prevent the number of SOQL queries issued from exceeding the platform governor limit. public class without sharing OpportunityService( public static List<OpportunityLineItem> getOpportunityProducts(Set<Id> opportunityIds){ List<OpportunitylineItem> oppLineItems = new List<OpportunityLineItem>(); for(Id thisOppId : opportunityIds){ oppLineItems.addAll([Select Id FROM OpportunityLineItems WHERE OpportunityId = :thisOppId)]; } return oppLineItems; } } The above method might be called during a trigger execution via a Lightning component. Which technique should be implemented to avoid reaching the governor limit?

Question4: Which three web technologies can be integrated into a Visualforce page? (Choose three.)

Question5: A developer is implementing an Apex class for a financial system. Within the class, the variables 'creditAmount' and 'debtAmount' should not be able to change once a value is assigned. In which two ways can the developer declare the variables to ensure their value can only be assigned one time? Choose 2 answers

Question6: Which statement is true about developing in a multi-tenant environment?

Question7: In the following example, which sharing context will myMethod execute when it is invoked?

Question8: The values 'High', 'Medium', and 'Low' are Identified as common values for multiple picklist across different object. What is an approach a developer can take to streamline maintenance of the picklist and their values, while also restricting the values to the ones mentioned above?

Question9: Which action causes a before trigger to fire by default for Accounts?

Question10: A developer has a VF page and custom controller to save Account records. The developer wants to display any validation rule violation to the user. How can the developer make sure that validation rule violations are displayed?

Question11: Which three operations affect the number of times a trigger can fire?
Choose 3 answers

Question12: What are two ways for a developer to execute tests in an org?

Question13: Which two statements are accurate regarding Apex classes and interfaces?
Choose 2 answers

Question14: A developer needs to create a custom button for the Account object that, when clicked, will perform a series of calculation and redirect the user to a custom visualforce page.
Which three attributes need to be defined with values in the <apex:page> tag to accomplish this?
Choose 3 answers

Question15: Which two types of process automation can be used to calculate the shipping cost for an Order when the Order is placed and apply a percentage of the shipping cost of some of the related Order Products?
Choose 2 answers

Question16: An org tracks customer orders on an Order object and the items of an Order on the Line Item object. The Line Item object has a MasterDetail relationship to the order object. A developer has a requirement to calculate the order amount on an Order and the line amount on each Line item based on quantity and price.
What is the correct implementation?

Question17: A developer needs to create a baseline set of data (Accounts, Contacts, Products, Assets) for an entire suite of test allowing them to test independent requirements various types of Salesforce Cases.
Which approach can efficiently generate the required data for each unit test?

Question18: A developer observes that an Apex test method fails in the Sandbox. To identify the issue, the developer copies the code inside the test method and executes it via the Execute Anonymous tool in the Developer Console. The code then executes with no exceptions or errors. Why did the test method fail in the sandbox and pass in the Developer Console?

Question19: A developer needs an Apex method that can process Account or Contact records. Which method signature should the developer use?

Question20: Which two statements are true about Getter and Setter methods as they relate to Visualforce?

Question21: A developer must create a lightning component that allows users to input contact record information to create a contact record, including a salary__c custom field. what should the developer use, along with a lightning-record-edit form, so that salary__c field functions as a currency input and is only viewable and editable by users that have the correct field levelpermissions on salary__C?

Question22: A developer wants to retrieve the Contacts and Users with the email address '[email protected]'.
Which SOSL statement should the developer use?

Question23: When using SalesforceDX, what does a developer need to enable to create and manage scratch orgs?

Question24: developer created this Apex trigger that calls MyClass .myStaticMethod:
trigger myTrigger on Contact(before insert) ( MyClass.myStaticMethod(trigger.new, trigger.oldMap); } The developer creates a test class with a test method that calls MyClass.mystaticMethod, resulting in 81% overall code coverage. What happens when the developer tries to deploy the trigger and two classes to production, assuming no other code exist?

Question25: While writing a test class that covers an OpportunityLineItem trigger, a Developer is unable to create a standard PriceBook since one already exists in the org.
How should the Developer overcome this problem?

Question26: A team of developers is working on a source-driven project that allows them to work independently, with many different org configurations. Which type of Salesforce orgs should they use for their development?

Question27: What is the result of the following code snippet?

Question28: A developer creates a new Apex trigger with a helper class, and writes a test class that only exercises 95% coverage of new Apex helper class. Change Set deployment to production fails with the test coverage warning:
"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required" What should the developer do to successfully deploy the new Apex trigger and helper class?

Question29: A developer is creating a test coverage for a class and needs to insert records to validate functionality. Which method annotation should be used to create records for every method in the test class?

Question30: What is the maximum number of SOQL queries used by the following code? List<Account> aList = [SELECT Id FROM Account LIMIT 5]; for (Account a : aList){ List<Contact> cList = [SELECT Id FROM Contact WHERE AccountId = :a.Id); }

Question31: A developer must write an Apex method that will be called from a Lightning component. The method may delete an Account stored in the accountRec variable.
Which method should a developer use to ensure only users that should be able to delete Accounts can successfully perform deletions?

Question32: In terms of the MVC paradigm, what are two advantages of implementing the layer of a Salesforce application using Aura Component-based development over Visualforce? Choose 2 answers

Question33: A developer writes a trigger on the Account object on the before update event that increments a count field. A workflow rule also increments the count field every time that an Account is created or update. The field update in the workflow rule is configured to not re-evaluate workflow rules. What is the value of the count field if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account?

Question34: What are two characteristics related to formulas? Choose 2 answers.

Question35: What will be the output in the debug log in the event of a QueryExeption during a call to the @query method in the following Example?

Question36: A developer needs to create a custom Interface in Apex.
Which three considerations must the developer keep in mind while developing the Apex Interface' Choose 3 answers

Question37: What is the order of operations when a record is saved in Salesforce?

Question38: Which two statements are true about using the @testSetup annotation in an Apex test class?
Choose 2 answers

Question39: Which Apex class contains methods to return the amount of resources that have been used for a particular governor, such as the number of DML statements?

Question40: A developer is asked to create a Visualforce page that displays some Account fields as well as fields configured on the page layout for related Contacts.
How should the developer implement this request?

Question41: A developer needs to join data received from an integration with an external system with parent records in Salesforce. The data set does not contain the Salesforce IDs of the parent records, but it does have a foreign key attribute that can be used to identify the parent.
Which action will allow the developer to relate records in the data model without knowing the Salesforce ID?

Question42: How many accounts will be inserted by the following block ofcode? for(Integer i = 0 ; i <
500; i++) { Account a = new Account(Name='New Account ' + i); insert a; }
* 0
87. Boolean odk;
Integer x;
if(abok=false;integer=x;){
X=1;
}elseif(abok=true;integer=x;){
X=2;
}elseif(abok!=null;integer=x;){
X=3;
)elseif{
X=4;}

Question43: What is the value of the Trigger.old context variable in a Before Insert trigger?

Question44: Which two are best practices when it comes to component and application event handling? (Choose two.)

Question45: A developer uses a loop to check each Contact in a list. When a Contact with the Title of
"Boss" is found, the Apex method should jump to the first line of code outside of the for loop.
Which Apex solution will let the developer implement this requirement?

Question46: Given the following code snippet, that is part of a custom controller for a Visualforce page:

In which two ways can the try/catch be enclosed to enforce object and field-level permissions and prevent the DML statement from being executed if the current logged-in user does not have the appropriate level of access? Choose 2 answers

Question47: A developer must create an Apex class, contactcontroller, that a Lightning component can use to search for Contact records. User of the Lightning component should only be able to search Contact records to which they have access. Which two will restrict the records correctly?

Question48: What are three techniques that a developer can use to invoke an anonymous block of code? (Choose three.)

Question49: A workflow updates the value of a custom field for an existing Account.
How can a developer access the updated custom field value from a trigger?

Question50: A developer must create a ShippingCalculator class that cannot be instantiated and must include a working default implementation of a calculate method, that sub-classes can override. What is the correct implementation of the ShippingCalculator class?

Question51: If apex code executes inside the execute() method of an Apex class when implementing the Batchable interface, which statement are true regarding governor limits? Choose 2 answers

Question52: A developer is asked to create a Visualforce page for Opportunities that allows users to save or merge the current record.
Which approach should the developer to meet this requirement?

Question53: What are two ways a developer can get the status of an enquered job for a class that queueable interface?
Choose 2 answers

Question54: Which two are phases in the Salesforce Application Event propagation framework? Choose
2 answers

Question55: A Visual Flow uses an apex Action to provide additional information about multiple Contacts, stored in a custom class, contactInfo. Which is the correct definition of the Apex method that gets additional information?

Question56: Which three statements are true regarding trace flags? (Choose three.)

Question57: A developer considers the following snippet of code:

Based on this code, what is the value of x?

Question58: A developer wants to invoke on outbound message when a record meets a specific criteria.
Which three features satisfy this use case?
Choose 3 answer

Question59: A developer has the following requirements:
Calculate the total amount on an Order.
Calculate the line amount for each Line Item based on quantity selected and price.
Move Line Items to a different Order if a Line Item is not stock.
Which relationship implementation supports these requirements?

Question60: A developer wrote Apex code that calls out to an external system. How should a developer write the test to provide test coverage?

Question61: How should a custom user interface be provided when a user edits an Account in Lightning Experience?

Question62: Which three data types can a SOQL query return? Choose 3 answers

Question63: Which aspect of Apex programming is limited due to multitenancy?

Question64: A developer has a Visualforce page and custom controller to save Account records. The developer wants to display any validation rule violation to the user. How can the developer make sure that validation rule violations are displayed?

Question65: A development team wants to use a deployment script lo automatically deploy lo a sandbox during their development cycles.
Which two tools can they use to run a script that deploys to a sandbox?
Choose 2 answers

Question66: Which code displays the content of Visualforce page as PDF?